/*
 * =====================================================================================
 *
 *       Filename:  main.cc
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2022年01月20日 23时28分42秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  first_name last_name (fl), fl@my-company.com
 *        Company:  my-company
 *
 * =====================================================================================
 */

#include <iostream>
#include <memory>

using namespace std;

int main () {

    unique_ptr <int>  up1 (new int(11));
    //unique_ptr <int> up2 = up1;  //不能通过编译
    cout << "up1: " << *up1 << endl;

    unique_ptr<int> up3 = move(up1);

    cout << "up3: " << *up3 << endl;
    //cout << "up1: " << *up1 << endl;
    //
    up3.reset();
    up1.reset();
    //cout << "up3: " << *up3 << endl;

    shared_ptr<int> sp1(new int(22));
    shared_ptr<int> sp2 = sp1; 
    cout << "sp1: " << *sp1 <<endl;
    cout << "sp2: " << *sp2 <<endl;

    sp1.reset();
    cout << "sp2-2: " << *sp2 <<endl;


}
